﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Collections;
//using System.Drawing;
using ElectronicsMarket_Desktop.EMServices;
namespace ElectronicsMarket_Desktop.BL

{
   public class ProductBL
    {

       ServicesReleaseSoapClient services;
       PRODUCT _product;

       public PRODUCT Product
       {
           get { return _product; }
           set { _product = value; }
       }
       
       public ProductBL()
       {
           Product = new PRODUCT();
            services = new ServicesReleaseSoapClient();
       }
       public List<PRODUCT> getAllProduct()
       {
           List<PRODUCT> listproduct = new List<PRODUCT>();

           listproduct = services.getProductList().ToList();
          
           return listproduct;
          
       }
       public PRODUCT getProdcutByID()
       {
           
           Product = services.getProductById(Product.PRODUCT_ID);
           return Product;
       }
       public Image GetImage(byte[] pic)
       {
           return services.ConvertFromBinary(pic);
       }

       public void insertProduct(PRODUCT product)
       {
               services.insertProduct(product);
           
           
       }
       public void deleteProduct(PRODUCT product)
       {
           services.deleteProduct(product);
       }
       public void updateProduct(PRODUCT product)
       {
           services.updateProduct( product);
       }
       public long getLastProductID()
       {
           return services.getLastProduciId();
       }
    }
}
